﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ShopCD.GUI
{
    public partial class frm_ShopCD : Form
    {
        public frm_ShopCD()
        {
            InitializeComponent();
        }

        BusinessLogic.bl_ShopCD blCD;

        private void frm_ShopCD_Load(object sender, EventArgs e)
        {
            blCD = new BusinessLogic.bl_ShopCD(this);
            blCD.Show(null);
        }

        private void bt_Delete_Click(object sender, EventArgs e)
        {
            blCD.Delete();
        }

        private void bt_Edit_Click(object sender, EventArgs e)
        {
            blCD.Edit();
        }

        private void bt_Save_Click(object sender, EventArgs e)
        {
            blCD.Save();
        }

        private void bt_Add_Click(object sender, EventArgs e)
        {
            blCD.Add();
        }

        private void cb_MaDM_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.tb_MaDM.Text = cb_MaDM.SelectedValue.ToString();
            }
            catch (NullReferenceException) { }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                this.cb_MaDM.SelectedValue = tb_MaDM.Text;
            }
            catch (InvalidOperationException) { }
            
        }
    }
}
